package org.komarichin.beans.service;

import org.komarichin.beans.IComment;
import org.komarichin.beans.IGenericEntity;
import org.komarichin.beans.IHasComment;

import java.io.Serializable;
import java.util.Collection;

/**
 * <p>
 * &nbsp;
 * </p>
 * User: Michael Komarichin
 * Date: Mar 10, 2010
 * Time: 9:19:39 PM
 */
public interface ICommentService<PK> extends Serializable {
    /**
     * save entity
     *
     * @param comment saving entity
     * @return saved entity
     */

    IComment<PK> save(IComment<PK> comment);

    /**
     * save or update entity
     *
     * @param comment saving or updation entity
     */
    void saveOrUpdate(IComment<PK> comment);

    /**
     * @param comment removed entity
     */
    void remove(IComment<PK> comment);

    /**
     * @param id identifier removed entity
     */
    void remove(PK id);

    /**
     * @param id identifier  entity for finding
     * @return found entity
     */
    IComment<PK> findById(PK id);

    /**
     * @param classObj class type
     * @param idValue  identifier object
     * @return collection of entities for identifier object of classobj type
     */
    Collection<IComment<PK>> getCommentsForObject(Class<? extends IHasComment<IComment<PK>, IGenericEntity>> classObj, Object idValue);

    /**
     * @param obj object
     * @return collection of entities for obj
     */
    Collection<IComment<PK>> getCommentsForObject(IHasComment<IComment<PK>, IGenericEntity> obj);

    /**
     * @return collection of entities
     */
    Collection<IComment<PK>> getAll();

    /**
     * @param obj     object in assigned
     * @param comment assigned comment
     */
    void assignCommentToObject(IHasComment<IComment<PK>, IGenericEntity> obj, IComment<PK> comment);
}
